package com.joe.mp4_demo.controller;

import com.joe.mp4_demo.utils.DownLoadUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletResponse;

@Controller
public class IndexController {

    @RequestMapping(value = "/index",method = RequestMethod.GET)
    public String index(){
        return "index";
    }

    @RequestMapping(value = "/downLoadIndex/{fileName}",method = RequestMethod.GET)
    public void downLoadIndex(@PathVariable("fileName") String fileName, HttpServletResponse response)throws Exception{
        String path1 = "C:/Users/Administrator/Desktop/test/";
        DownLoadUtil.downloadLocal(path1 , fileName, response);
    }
}
